package com.boot.apollo.modules.guava;

import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;

import java.util.Objects;

public class GuavaTest {
    private static final Joiner cateNameJoiner = Joiner.on("|||");


    public static void main(String[] args) {







    }

    public static void testJoin(String appId) {

        System.out.println(cateNameJoiner.join("111","123"));
        System.out.println(cateNameJoiner.join("","123"));
        System.out.println(cateNameJoiner.join(null,"123"));

    }



    public static boolean isAppNamespaceNameUnique(String appId) {
        Objects.requireNonNull(appId, "AppId must not be null");

        return Objects.isNull(appId);
    }

    private static  void testGuava() {
        // https://www.jianshu.com/p/d8ec4eaac6f5

        //Preconditions.checkArgument(false);

        Preconditions.checkArgument(false,"this is a test!"); //this is a test!
        Preconditions.checkArgument(false,"%s is a %s","hjh","pig"); //hjh is a pig
        Preconditions.checkElementIndex(20, 10); //java.lang.IndexOutOfBoundsException: index (20) must be less than size (10)
        Preconditions.checkPositionIndex(20, 10, "desc !!!!"); //java.lang.IndexOutOfBoundsException: desc !!!! (20) must not be greater than size (10)
        Preconditions.checkPositionIndex(20, 10); //java.lang.IndexOutOfBoundsException: index (20) must not be greater than size (10)
        Preconditions.checkState(false); // java.lang.IllegalStateException
        Preconditions.checkNotNull(1);//1
        Preconditions.checkNotNull(null,"is null");  //java.lang.NullPointerException: is null
        Preconditions.checkNotNull(null, "%s is null !", "object"); //java.lang.NullPointerException: object is null !


    }

}
